#incoding=utf-8
from django.db import models

# Create your models here.
class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(max_length=200)
    votes = models.IntegerField()
    

from pydemo.polls.models import Poll
from pydemo.polls.models import Choice   
from django.contrib import admin

class ChoiceInline(admin.TabularInline):
    model=Choice
    extra=3
             
class PollAdmin(admin.ModelAdmin):
    fieldsets=[
        ('问题',{'fields':['question']}),
        ('日期',{'fields':['pub_date'],'classes':['collapse']}),
    ]
    inlines=[ChoiceInline]
    
admin.site.register(Poll, PollAdmin)
    
    
    
    
    